package com.haopeng.common.response;
/**
 * 统一响应处理类
 * @author Administrator
 *
 */
public final class ResponseModel {

	
	private int code=200;
	
	private String message="";
	
	private Object result;
	
	public ResponseModel() {
	}

	public ResponseModel(Object result) {
		this.result = result;
	}

	public ResponseModel(Integer code, String message) {
		this.code = code;
		this.message = message;
	}

	public static ResponseModel success(Object result) {
		return new ResponseModel(result);
	}
	
	public static ResponseModel success() {
		return new ResponseModel();
	}
	
	public static ResponseModel failure(String message) {
		return new ResponseModel(500, message);
	}

	public Integer getStatus() {
		return code;
	}

	public String getReason() {
		return message;
	}

	public Object getResult() {
		return result;
	}

	@Override
	public String toString() {
		return "[code:"+code+",message:"+message+",result"+result+"]";
	}
	
	
	
}
